#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,q,p=1;
int read(){
	int x=0;
	char c=getchar();
	while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+c-'0',c=getchar();
	return x;
}
struct c{
	int g,h;
}a[100005],b[100005];
bool cmp(c x,c y){
	return x.g<y.g||x.g==y.g&&x.h<y.h;
}
signed main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	n=read(),q=read();
	for(int i=1;i<=n;i++) a[i].g=read(),a[i].h=i;
	while(q--){
		int x=read();
		if(x==1){
			int l=read(),r=read();
			a[l].g=r;
			p=1;
		}
		else {
			int y=read();
			if(p==1) {
				for(int i=1;i<=n;i++) b[i].g=a[i].g,b[i].h=i;
				sort(b+1,b+1+n,cmp);
				p=0;
			}
			for(int i=1;i<=n;i++) if(b[i].h==a[y].h) {cout<<i<<"\n";break;}
			
		}
	}
	return 0;
}
